package com.luxuewen.sxa.controller;


import com.luxuewen.sxa.entity.validator.LoginVo;
import com.luxuewen.sxa.service.impl.AuthServiceImpl;
import com.luxuewen.sxa.utils.response.ApiResponse;
import jakarta.validation.constraints.NotNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author wen
 */
@Slf4j
@RestController
@Validated
public class AuthController {
    @Autowired
    private AuthServiceImpl authService;

    @PostMapping("auth/login")
    public ApiResponse<Map<String, Object>> login (@Validated @RequestBody LoginVo loginVo) {
        return ApiResponse.success(authService.login(loginVo.getUsername(), loginVo.getPassword()));
    }
}
